package day7;

import java.util.ArrayList;

/**
 * @author oldliu
 * @since 1.0
 */
public class JavaClass {
    String name;//名称
    String teacher;
    String dirTeacher;//
    String start;//开班时间
    //存放班级学生姓名，类似数组
    ArrayList<String> stus=new ArrayList<>();

    //加新生
    public void add(String name){
        stus.add(name);
    }
    //显示班级的信息
    public void show(){
        System.out.println("班级名称:"+name);
        System.out.println("指导老师:"+teacher+",班主任："+dirTeacher);
        System.out.println("学生信息如下：");
        System.out.println(stus);
    }
    //找学生在不在这个班级
    public boolean search(String name){
        for (int i = 0; i < stus.size(); i++) {
            if(name.equals(stus.get(i)))
                return true;
        }
        return  false;
    }
    //在区间范围内找人
    public boolean search1(int start,int end,String name){

        start=start<0?0:start;

        for (int i = start; i < end&&i<stus.size(); i++) {
            if(name.equals(stus.get(i)))
                return true;
        }
        return false;
    }
    public boolean modifyName(String oldName,String newName){
        return false;
    }
}
